home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Animation How-To
/
Animation How-to CD.iso
/
PLY
/
CHAPTER5
/
VOLCANO
/
VOLCANO2.BAS
< prev
next >
Wrap
BASIC Source File
|
1994-01-01
|
3KB
|
73 lines
OPEN "volcano2.pi" FOR OUTPUT AS #1
print #1, "start_frame 0"
print #1, "end_frame 200"
print #1, "total_frames 200"
print #1,
print #1, "outfile volc2"
print #1,
print #1, "include ";chr$(34);"\ply\colors.inc";chr$(34)
print #1,
print #1, "viewpoint {"
print #1, " from <25,-2,15>"
print #1, " at <0,-2,0>"
print #1, " up <0,1,0>"
print #1, " angle 35"
print #1, " resolution 320,200"
print #1, " aspect 1.43"
print #1, " }"
print #1, "background SkyBlue"
print #1,
print #1, "light 0.6*white, < 10,50, 15>"
print #1, "light 0.6*white, < 0,50, 0>"
print #1,
print #1, "object { cone <0,0,0>,0,<0,-20,0>,20 reflective_white}"
print #1,
PRINT #1, "define rise 1"
PRINT #1, "define run 1"
PRINT #1, "define br 1 // ball radius"
PRINT #1, "define mindamprate 10"
PRINT #1, "define g 1"
PRINT #1, "define pi 3.14159"
PRINT #1, "define rad pi / 180"
PRINT #1,
PRINT #1, " // Set the initial conditions"
FOR item = 0 TO 99
count$ = RIGHT$("00" + LTRIM$(STR$(item)), 2)
PRINT #1, "if (frame == start_frame) {"
PRINT #1, USING " static define x\\ 0"; count$
PRINT #1, USING " static define y\\ 0"; count$
PRINT #1, USING " static define z\\ 0"; count$
PRINT #1, USING " define r\\ [5*brownian(<0.1,0.1,0.1>)]"; count$
PRINT #1, USING " define radius r\\[0][0]"; count$
PRINT #1, USING " define theta 360 * r\\[0][1] * rad"; count$
PRINT #1, USING " define phi (30 + 30 * r\\[0][2]) * rad"; count$
PRINT #1, USING " define velo r\\[0][0]"; count$
PRINT #1, USING " static define dr\\ 20 + 20 * r\\[0][1]"; count$; count$
PRINT #1, USING " static define vx\\ radius * sin(phi) * cos(theta)"; count$
PRINT #1, USING " static define vy\\ radius * cos(phi) + velo"; count$
PRINT #1, USING " static define vz\\ radius * sin(phi) * sin(theta)"; count$
PRINT #1, "}"
PRINT #1, "else {"
PRINT #1, USING " static define x\\ x\\ + vx\\"; count$, count$, count$
PRINT #1, USING " static define y\\ y\\ + vy\\"; count$, count$, count$
PRINT #1, USING " static define z\\ z\\ + vz\\"; count$, count$, count$
PRINT #1, "}"
PRINT #1,
PRINT #1, USING "static define vy\\ vy\\ - g"; count$, count$
PRINT #1, USING "define dist (x\\^2 +z\\^2)^0.5"; count$, count$
PRINT #1, "define ring dist/run"
PRINT #1, USING "if (y\\ + ring*rise-br < 0)"; count$
PRINT #1, USING " { static define vy\\ fabs(vy\\)*(1 - ring / dr\\)"; count$, count$, count$
PRINT #1, USING " static define vx\\ vx\\*(1 - ring / dr\\)"; count$, count$, count$
PRINT #1, USING " static define vz\\ vz\\*(1 - ring / dr\\)"; count$, count$, count$
PRINT #1, "}"
PRINT #1, USING "object { sphere <x\\,y\\,z\\>,0.5 shiny__coral }"; count$, count$, count$
PRINT #1,
NEXT item
CLOSE #1